package com.example.server.controller;


import com.example.common.pojo.Department;
import com.example.server.service.IDepartmentService;
import com.example.common.vo.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小红
 * @since 2022-09-02
 */
@RestController
@RequestMapping("/system/basic/department")
public class DepartmentController {
    @Autowired
    private IDepartmentService iDepartmentService;
    @GetMapping("/")
    public List<Department> listDeptLevel(){
        return iDepartmentService.getDeptLevel();
    }

    @PostMapping("/")
    public RespBean addDept(@RequestBody Department department){
      return   iDepartmentService.addDept(department);
    }

    @DeleteMapping("/{id}")
    public RespBean DeleteDept(@PathVariable Integer id){

        return iDepartmentService.deleteDepartment(id);
    }
}
